/*
 * WtSettings.cs - Wordtrainer
 * 
 * Copyright (C) 1998-2007 Markus Kilås
 *               
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 *
 * Authors:
 *   Markus Kilås <markus@markuspage.com>
 * 
 */

using System;

namespace WtSharp
{
	
	
	public class WtSettings
	{
		private ApplicationStorage m_AppStorage;
		
		public WtSettings()
		{
			m_AppStorage = new ApplicationStorage();
		}

		public bool GetBool(string name, bool standard)
		{
			object val = m_AppStorage[name];
			if(val == null)
				return standard;
			return (bool)val;
		}
		
		public bool GetBool(string name)
		{
			object val = m_AppStorage[name];
			return (bool)val;
		}
		
		public int GetIntFromString(string name)
		{
			return Int32.Parse((string)m_AppStorage[name]);
		}
		
		public string GetString(string name, string standard)
		{
			object val = m_AppStorage[name];
			if(val == null)
				return standard;
			return (string)val;
		}
		
		public object GetObject(string name)
		{
			return m_AppStorage[name];
		}
		
		public void SetValue(string name, object val)
		{
			m_AppStorage[name] = val;
		}
		
		/*public object Item[object key]
		{
			get
			{
				return m_AppStorage[key];
			}
			set
			{
				m_AppStorage[key] = value;
			}
		}*/
		
		public void Save()
		{			
			m_AppStorage.Save();
		}
		
		
		
	}
}
